--- title: Capture keywords: fastai sidebar: home_sidebar summary: "Wrapper class and example code for getting images from the OpenHSI using a ximea detetor (with IMX252 sensor, e.g. MX031CG-SY. " description: "Wrapper class and example code for getting images from the OpenHSI using a ximea detetor (with IMX252 sensor, e.g. MX031CG-SY. " nb_path: "01_capture.ipynb" ---
Running in notebook slow downs.
To add a custom camera, four methods need to be defined in a class to:
__init__, start_cam,stop_cam, andget_img.By inheriting from the OpenHSI class, all the methods to load settings/calibration files, collect datacube, saving data to NetCDF, and viewing as RGB are integrated. Furthermore, the custom camera class can be passed to a SettingsBuilder class for calibration.
with SimulatedCamera(img_path="assets/rocky_beach.png", n_lines=1024, processing_lvl = 3) as cam:
cam.collect()
fig = cam.show(robust=True)
fig
plt.imshow(cam.rgb_buff.data)
plt.plot(cam.λs,cam.xs[0],'r',label="X(λ)")
plt.plot(cam.λs,cam.ys[0],'g',label="Y(λ)")
plt.plot(cam.λs,cam.zs[0],'b',label="Z(λ)")
plt.grid(); plt.minorticks_on()
plt.legend()
plt.xlabel("λ (nm)")
plt.ylabel("CIE XYZ value")
plt.plot(cam.binned_wavelengths,cam.dc.data[350,300,:],label="rock")
plt.plot(cam.binned_wavelengths,cam.dc.data[50,300,:], label="sky")
plt.plot(cam.binned_wavelengths,cam.dc.data[150,300,:],label="water")
plt.legend()
plt.xlabel("wavelength (nm)")
plt.ylabel("pseudo-spectra")
Used for the OpenHSI Camera Mark I.
Make sure you install the Ximea API beforehand in the instructions https://www.ximea.com/support/wiki/apis/Python
with XimeaCamera(n_lines=1024, processing_lvl = 3) as cam:
cam.collect()
fig = cam.show(robust=True)
fig